package com.zhl.mail.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: demos
 * @description:
 * @author: 刘振华
 * @create: 2020-11-11 10:31
 **/
@RestController
public class MailController {
	@Autowired
	private JavaMailSender javaMailSender;
	@GetMapping("/sendtest")
	public Object sendTest() {
		SimpleMailMessage smm = new SimpleMailMessage();
		smm.setFrom("iiot@cnpc.com.cn");
		smm.setTo("liuzhenhua01@cnpc.com.cn");
		smm.setSubject("测试邮件");
		smm.setText("测试内容");
		javaMailSender.send(smm);
		return "OK";
	}
}
